package com.baizhiedu.baizhiappsys.controller;

import com.baizhiedu.baizhiappsys.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author lby
 */
@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 获取全部的用户信息
     * @return
     * offset 开始行数
     *  limit 每页总共多少行数据
     */
    @RequestMapping("selectAllUser")
    @ResponseBody
    public Map selectAllUser(Integer offset,Integer limit){
        Map map = userService.selectAllByLimit(offset, limit);
        return map;
    }

    /**
     * 根据手机号 查询用户信息
     * @param searchContext
     * @return
     */
    @RequestMapping("searchUserByPhone")
    @ResponseBody
    public Map searchUserByPhone(String searchContext){
        System.out.println(searchContext);
        return userService.searchUserByPhone(searchContext);
    }
}
